package generic;

import java.util.ArrayList;
import java.util.List;

/**
 * @author lwmzzz
 * @version 1.0
 * @date 2021/4/5 16:24
 * @description
 */
public class Student<E> {
    private E data;

    public Student(E data) {
        this.data = data;
    }

    public Student() {

    }

    @Override
    public String toString() {
        return "Student{" +
                "data=" + data +
                '}';
    }

    public E getData() {
        return data;
    }

    public void setData(E data) {
        this.data = data;
    }

    public static <T> List<T> convert(T[] array) {
        List<T> list = new ArrayList<>();
        for (T t : array) {
            list.add(t);
        }
        return list;
    }

    public static void main(String[] args) {
        List<Integer> convert = Student.convert(new Integer[]{1, 2, 3, 4, 5});
        System.out.println(convert);
    }
}
